﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GcmpRenderingInterface.h"

namespace gcmp
{
    class IDocument;
    class IGraphicsNode;
    class Vector3d;
    class Vector2d;
    struct DiscreteEpsilon;

    /// \brief 面离散数据访问器
    class GCMP_RENDERING_INTERFACE_EXPORT IFaceDiscretingVisitor
    {
    public:
        virtual ~IFaceDiscretingVisitor() = default;

        /// \brief 创建一个访问器
        /// \param pDocument 所在文档指针
        /// \param discreteEpsilon 离散精度
        /// \param is2CreateIndex 离散数据是否带索引
        /// \param OwnerPtr<IFaceDiscretionVisitor> 创建出来的离散访问器
        static OwnerPtr<IFaceDiscretingVisitor> Create(const IDocument* pDocument, const DiscreteEpsilon& discreteEpsilon, bool is2CreateIndex);

        /// \brief 遍历给定的GraphicsNode
        /// \param pGNode  待遍历的图形节点
        virtual void DoTraverse(const IGraphicsNode* pGNode) = 0;
        
        /// \brief 数据是否有效
        /// \return true-有效的， false-无效的
        virtual bool IsDataValid() const = 0;

        /// \brief 离散数据是否有带索引
        /// \return true-带索引， false-不带索引
        virtual bool IsToCreateIndex() const = 0;

        /// \brief 获取顶点坐标个数
        /// \return  顶点坐标个数
        virtual size_t GetVerticesCount() const = 0;

        /// \brief 获取索引个数
        /// \return 索引个数
        virtual size_t GetIndicesCount() const = 0;

        /// \brief 获取顶点集合
        /// \return 顶点集合
        virtual const std::vector<Vector3d>& GetVertices() = 0;

        /// \brief 获取法线集合
        /// \return 法线集合
        virtual const std::vector<Vector3d>& GetNormals() = 0;

        /// \brief 获取纹理坐标集合
        /// \return 纹理坐标集合
        virtual const std::vector<Vector2d>& GetUVs() const = 0;

        /// \brief 获取索引集合
        /// \return 索引集合
        virtual const std::vector<unsigned int>& GetIndices() const = 0;

    };
}

